﻿
namespace bookMaster.AssetSystem.Windows.Forms
{
	/// <summary>
	/// This is the abstract edit form for the <see cref="Entities.Clientes"/> entity.
	/// </summary>
	/// <remarks>This class is overwritten by .netTiers at each generation.</remarks>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class ClientesEditControlBase : System.Windows.Forms.UserControl
	{
		#region Fields
		
		//private System.Windows.Forms.TableLayoutPanel uxTableLayoutPanel;
		/// <summary>
		/// The ErrorProvider for the Entity;
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxErrorProvider;
		
		/// <summary>
		/// The BindingSource for the entity.
		///</summary>
		protected System.Windows.Forms.BindingSource uxBindingSource;
						
		
		/// <summary>
		/// TextBox for the IdCliente property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxIdCliente;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IdCliente property.
		/// </summary>
		protected System.Windows.Forms.Label uxIdClienteLabel;
		
		/// <summary>
		/// TextBox for the NombreCliente property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxNombreCliente;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the NombreCliente property.
		/// </summary>
		protected System.Windows.Forms.Label uxNombreClienteLabel;
		
		/// <summary>
		/// ComboBox for the IdCiudad property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxIdCiudad;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IdCiudad property.
		/// </summary>
		protected System.Windows.Forms.Label uxIdCiudadLabel;
		
		/// <summary>
		/// TextBox for the DireccionCliente property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxDireccionCliente;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the DireccionCliente property.
		/// </summary>
		protected System.Windows.Forms.Label uxDireccionClienteLabel;
		
		/// <summary>
		/// TextBox for the TelefonoCliente property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxTelefonoCliente;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the TelefonoCliente property.
		/// </summary>
		protected System.Windows.Forms.Label uxTelefonoClienteLabel;
		
		/// <summary>
		/// TextBox for the EstadoCliente property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxEstadoCliente;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the EstadoCliente property.
		/// </summary>
		protected System.Windows.Forms.Label uxEstadoClienteLabel;
		#endregion
		
		#region Main entity
		private Entities.Clientes _Clientes;
		/// <summary>
		/// Gets or sets the <see cref="Entities.Clientes"/> entity to edit with this form.
		/// </summary>
		/// <value>The <see cref="Entities.Clientes"/> instance.</value>
		public Entities.Clientes Clientes
		{
			get {return this._Clientes;}
			set
			{
				this._Clientes = value;
				if (value != null) 
				{
					this.uxBindingSource.DataSource = value;
					BindControls();
				}			
				
			}
		}
		#endregion
		
		/// <summary>
		/// Binds the controls.
		/// </summary>
		private void BindControls()
		{
			this.uxIdCliente.DataBindings.Clear();
			this.uxIdCliente.DataBindings.Add("Text", this.uxBindingSource, "IdCliente", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxNombreCliente.DataBindings.Clear();
			this.uxNombreCliente.DataBindings.Add("Text", this.uxBindingSource, "NombreCliente", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxIdCiudad.DataBindings.Clear();
			this.uxIdCiudad.DataBindings.Add("SelectedValue", this.uxBindingSource, "IdCiudad", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxDireccionCliente.DataBindings.Clear();
			this.uxDireccionCliente.DataBindings.Add("Text", this.uxBindingSource, "DireccionCliente", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxTelefonoCliente.DataBindings.Clear();
			this.uxTelefonoCliente.DataBindings.Add("Text", this.uxBindingSource, "TelefonoCliente", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxEstadoCliente.DataBindings.Clear();
			this.uxEstadoCliente.DataBindings.Add("Text", this.uxBindingSource, "EstadoCliente", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
		}					
		
		#region Constructor
		
		/// <summary>
		/// Initializes a new instance of the <see cref="ClientesEditControlBase"/> class.
		/// </summary>
		public ClientesEditControlBase()
		{
			InitializeComponent();			
			
			this.uxBindingSource.CurrentItemChanged += new System.EventHandler(uxBindingSource_currentItemChanged);
		}		
		
		/// <summary>
		/// 
		/// </summary>
		private void uxBindingSource_currentItemChanged(object sender, System.EventArgs e)
		{
			if (_Clientes != null) _Clientes.Validate();
		}	
				
		/// <summary>
		/// Initializes the component.
		/// </summary>
		public void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.uxErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxBindingSource = new System.Windows.Forms.BindingSource(this.components);
			
			//this.uxTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
			this.uxIdCliente = new System.Windows.Forms.TextBox();
			uxIdClienteLabel = new System.Windows.Forms.Label();
			this.uxNombreCliente = new System.Windows.Forms.TextBox();
			uxNombreClienteLabel = new System.Windows.Forms.Label();
			this.uxIdCiudad = new System.Windows.Forms.ComboBox();
			uxIdCiudadLabel = new System.Windows.Forms.Label();
			this.uxDireccionCliente = new System.Windows.Forms.TextBox();
			uxDireccionClienteLabel = new System.Windows.Forms.Label();
			this.uxTelefonoCliente = new System.Windows.Forms.TextBox();
			uxTelefonoClienteLabel = new System.Windows.Forms.Label();
			this.uxEstadoCliente = new System.Windows.Forms.TextBox();
			uxEstadoClienteLabel = new System.Windows.Forms.Label();
			
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).BeginInit();
			this.SuspendLayout();
			
			// 
			// uxTableLayoutPanel
			// 
			//this.uxTableLayoutPanel.AutoSize = true;
			//this.uxTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
			//this.uxTableLayoutPanel.ColumnCount = 2;
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 120F));
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 250F));
			//this.uxTableLayoutPanel.Location = new System.Drawing.System.Drawing.Point(3, 3);
			//this.uxTableLayoutPanel.Name = "uxTableLayoutPanel";
			//this.uxTableLayoutPanel.RowCount = 2;
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.Size = new System.Drawing.Size(450, 50);
			//this.uxTableLayoutPanel.TabIndex = 0;
			
			//
			// uxErrorProvider
			//
			this.uxErrorProvider.ContainerControl = this;
			this.uxErrorProvider.DataSource = this.uxBindingSource;
			
			//
			// uxIdClienteLabel
			//
			this.uxIdClienteLabel.Name = "uxIdClienteLabel";
			this.uxIdClienteLabel.Text = "Id Cliente:";
			this.uxIdClienteLabel.Location = new System.Drawing.Point(3, 0);
			this.Controls.Add(this.uxIdClienteLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIdClienteLabel);			
			//
			// uxIdCliente
			//
			this.uxIdCliente.Name = "uxIdCliente";
			this.uxIdCliente.ReadOnly = true;
			//this.uxTableLayoutPanel.Controls.Add(this.uxIdCliente);
			this.uxIdCliente.Location = new System.Drawing.Point(160, 0);
			this.Controls.Add(this.uxIdCliente);
			//
			// uxNombreClienteLabel
			//
			this.uxNombreClienteLabel.Name = "uxNombreClienteLabel";
			this.uxNombreClienteLabel.Text = "Nombre Cliente:";
			this.uxNombreClienteLabel.Location = new System.Drawing.Point(3, 26);
			this.Controls.Add(this.uxNombreClienteLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxNombreClienteLabel);			
			//
			// uxNombreCliente
			//
			this.uxNombreCliente.Name = "uxNombreCliente";
			this.uxNombreCliente.Width = 250;
			this.uxNombreCliente.MaxLength = 100;
			//this.uxTableLayoutPanel.Controls.Add(this.uxNombreCliente);
			this.uxNombreCliente.Location = new System.Drawing.Point(160, 26);
			this.Controls.Add(this.uxNombreCliente);
			//
			// uxIdCiudadLabel
			//
			this.uxIdCiudadLabel.Name = "uxIdCiudadLabel";
			this.uxIdCiudadLabel.Text = "Id Ciudad:";
			this.uxIdCiudadLabel.Location = new System.Drawing.Point(3, 52);
			this.Controls.Add(this.uxIdCiudadLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIdCiudadLabel);			
			//
			// uxIdCiudad
			//
			this.uxIdCiudad.Name = "uxIdCiudad";
			//this.uxTableLayoutPanel.Controls.Add(this.uxIdCiudad);
			this.uxIdCiudad.Location = new System.Drawing.Point(160, 52);
			this.Controls.Add(this.uxIdCiudad);
			//
			// uxDireccionClienteLabel
			//
			this.uxDireccionClienteLabel.Name = "uxDireccionClienteLabel";
			this.uxDireccionClienteLabel.Text = "Direccion Cliente:";
			this.uxDireccionClienteLabel.Location = new System.Drawing.Point(3, 78);
			this.Controls.Add(this.uxDireccionClienteLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxDireccionClienteLabel);			
			//
			// uxDireccionCliente
			//
			this.uxDireccionCliente.Name = "uxDireccionCliente";
			this.uxDireccionCliente.Width = 250;
			this.uxDireccionCliente.MaxLength = 250;
			//this.uxTableLayoutPanel.Controls.Add(this.uxDireccionCliente);
			this.uxDireccionCliente.Location = new System.Drawing.Point(160, 78);
			this.Controls.Add(this.uxDireccionCliente);
			//
			// uxTelefonoClienteLabel
			//
			this.uxTelefonoClienteLabel.Name = "uxTelefonoClienteLabel";
			this.uxTelefonoClienteLabel.Text = "Telefono Cliente:";
			this.uxTelefonoClienteLabel.Location = new System.Drawing.Point(3, 104);
			this.Controls.Add(this.uxTelefonoClienteLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxTelefonoClienteLabel);			
			//
			// uxTelefonoCliente
			//
			this.uxTelefonoCliente.Name = "uxTelefonoCliente";
			this.uxTelefonoCliente.Width = 250;
			this.uxTelefonoCliente.MaxLength = 15;
			//this.uxTableLayoutPanel.Controls.Add(this.uxTelefonoCliente);
			this.uxTelefonoCliente.Location = new System.Drawing.Point(160, 104);
			this.Controls.Add(this.uxTelefonoCliente);
			//
			// uxEstadoClienteLabel
			//
			this.uxEstadoClienteLabel.Name = "uxEstadoClienteLabel";
			this.uxEstadoClienteLabel.Text = "Estado Cliente:";
			this.uxEstadoClienteLabel.Location = new System.Drawing.Point(3, 130);
			this.Controls.Add(this.uxEstadoClienteLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxEstadoClienteLabel);			
			//
			// uxEstadoCliente
			//
			this.uxEstadoCliente.Name = "uxEstadoCliente";
			//this.uxTableLayoutPanel.Controls.Add(this.uxEstadoCliente);
			this.uxEstadoCliente.Location = new System.Drawing.Point(160, 130);
			this.Controls.Add(this.uxEstadoCliente);
			//
			// uxIdCiudad
			//				
			this.uxIdCiudad.DisplayMember = "NombreCiudad";	
			this.uxIdCiudad.ValueMember = "IdCiudad";	
			// 
			// ClientesEditControlBase
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			//this.Controls.Add(this.uxTableLayoutPanel);
			this.AutoScroll = true;
			this.Name = "ClientesEditControlBase";
			this.Size = new System.Drawing.Size(478, 311);
			//this.Localizable = true;
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).EndInit();			
			this.ResumeLayout(false);
			this.PerformLayout();
		}
		#endregion
				
		#region ComboBox List
		
				
		private Entities.TList<Entities.Ciudades> _IdCiudadList;
		
		/// <summary>
		/// The ComboBox associated with the IdCiudad property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.Ciudades> IdCiudadList
		{
			get {return _IdCiudadList;}
			set 
			{
				this._IdCiudadList = value;
				this.uxIdCiudad.DataSource = null;
				this.uxIdCiudad.DataSource = value;
			}
		}
		
		private bool _allowNewItemInIdCiudadList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the IdCiudad property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIdCiudadList
		{
			get { return _allowNewItemInIdCiudadList;}
			set
			{
				this._allowNewItemInIdCiudadList = value;
				this.uxIdCiudad.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
		
		#endregion
		
        #region Field visibility

        /// <summary>
        /// Indicates if the controls associated with the uxIdCliente property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxIdClienteVisible
        {
            get { return this.uxIdCliente.Visible; }
            set
            {
                this.uxIdClienteLabel.Visible = value;
                this.uxIdCliente.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxIdCliente property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxIdClienteEnabled
        {
            get { return this.uxIdCliente.Enabled; }
            set
            {
                this.uxIdCliente.Enabled = value;
            }
        }
        /// <summary>
        /// Indicates if the controls associated with the uxNombreCliente property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxNombreClienteVisible
        {
            get { return this.uxNombreCliente.Visible; }
            set
            {
                this.uxNombreClienteLabel.Visible = value;
                this.uxNombreCliente.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxNombreCliente property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxNombreClienteEnabled
        {
            get { return this.uxNombreCliente.Enabled; }
            set
            {
                this.uxNombreCliente.Enabled = value;
            }
        }
        /// <summary>
        /// Indicates if the controls associated with the uxIdCiudad property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxIdCiudadVisible
        {
            get { return this.uxIdCiudad.Visible; }
            set
            {
                this.uxIdCiudadLabel.Visible = value;
                this.uxIdCiudad.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxIdCiudad property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxIdCiudadEnabled
        {
            get { return this.uxIdCiudad.Enabled; }
            set
            {
                this.uxIdCiudad.Enabled = value;
            }
        }
        /// <summary>
        /// Indicates if the controls associated with the uxDireccionCliente property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxDireccionClienteVisible
        {
            get { return this.uxDireccionCliente.Visible; }
            set
            {
                this.uxDireccionClienteLabel.Visible = value;
                this.uxDireccionCliente.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxDireccionCliente property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxDireccionClienteEnabled
        {
            get { return this.uxDireccionCliente.Enabled; }
            set
            {
                this.uxDireccionCliente.Enabled = value;
            }
        }
        /// <summary>
        /// Indicates if the controls associated with the uxTelefonoCliente property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxTelefonoClienteVisible
        {
            get { return this.uxTelefonoCliente.Visible; }
            set
            {
                this.uxTelefonoClienteLabel.Visible = value;
                this.uxTelefonoCliente.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxTelefonoCliente property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxTelefonoClienteEnabled
        {
            get { return this.uxTelefonoCliente.Enabled; }
            set
            {
                this.uxTelefonoCliente.Enabled = value;
            }
        }
        /// <summary>
        /// Indicates if the controls associated with the uxEstadoCliente property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxEstadoClienteVisible
        {
            get { return this.uxEstadoCliente.Visible; }
            set
            {
                this.uxEstadoClienteLabel.Visible = value;
                this.uxEstadoCliente.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxEstadoCliente property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxEstadoClienteEnabled
        {
            get { return this.uxEstadoCliente.Enabled; }
            set
            {
                this.uxEstadoCliente.Enabled = value;
            }
        }

        #endregion

		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	}
}
